<template>
  <div>
    <el-date-picker
      v-model="timer"
      type="daterange"
      range-separator="-"
      start-placeholder="起始日期"
      end-placeholder="结束日期"
      @change="handleDateChange"
    >
    </el-date-picker>
  </div>
</template>

<script>
export default {
    props:['keys'],
    data(){
        return {
            timer:[]
        }
    },
    methods:{
        handleDateChange(dates){
            let data = {}
            data[ `${this.keys}Start`] = new Date(dates[0]).getTime()
            data[ `${this.keys}End`] = new Date(dates[1]).getTime()
            // console.log(dates, this.keys, data)
            this.$emit('handleDateChange',data)
        }
    }
};
</script>
